package com.calclab.hablar.chatmedia.client.preferences;

import com.calclab.hablar.chatmedia.client.preferences.AddMediaDisplay.Field;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;


public class AddMediaPresenter {
    
    private final AddMediaDisplay display;
    
    public AddMediaPresenter(){
	this.display = new AddMediaWidget();
	
	display.getAdd().addClickHandler(new ClickHandler() {
	    @Override
	    public void onClick(final ClickEvent event) {
		//save new added media account
		display.asWidget().removeFromParent();
		String type = display.getField(Field.type).getText();
		String account = display.getField(Field.account).getText();
	    }
	});
	
	display.getClose().addClickHandler(new ClickHandler(){
	    @Override
	    public void onClick(final ClickEvent event) {
		display.asWidget().removeFromParent();
		
	    }
	});
    }
    
    public AddMediaDisplay getDisplay(){
	return display;
    }
}
